package dao;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

import po.Employment;
import po.Order;
import po.User;

public class SearchDao extends BaseHibernateDAO{
	
	//招聘信息查询
	public List findByHql(String hql) {
		try {
			String queryString = hql;
			Query queryObject = getSession().createQuery(queryString);
			return queryObject.list();
		} catch (RuntimeException re) {		
			throw re;
		} 
	} 
	
	//传入用户id 搜索用户信息
	public Object findUserInfo(int id) {
			
		try {
			Object obj = getSession().find(User.class, id);
			return obj;
		}catch (RuntimeException re) {
			//log.error("find by id failed", re);
			throw re;
		}
	}	
	
	//传入id 搜索招聘信息
	public Object findEmpInfo(int id) {
			
		try {
			Object obj = getSession().find(Employment.class, id);
			return obj;
		}catch (RuntimeException re) {
			//log.error("find by id failed", re);
			throw re;
		}
	}
	//传入id 搜索订单信息
	public Object findOrderInfo(int id) {
		try {
			Object obj = getSession().find(Order.class, id);
			return obj;
		}catch (RuntimeException re) {
			//log.error("find by id failed", re);
			throw re;
		}
	}
}
